{{{ template "web/layouts/header.html" . }}}

{{{ if .topic}}}
<div class="container">
    <div class="row">

        <div class="col-lg-3 col-md-3 hidden-sm hidden-xs author-info">
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="text-center">
                        作者：{{{ .topic.User.Name }}}
                    </div>
                    <hr>
                    <div class="media">
                        <div align="center">
                            <a href="/user/{{{ .topic.User.Id }}}">
                                <img class="thumbnail img-responsive" src="{{{ .topic.User.Avatar }}}" width="300px" height="300px">
                            </a>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-lg-9 col-md-9 col-sm-12 col-xs-12 topic-content">
            <div class="panel panel-default">
                <div class="panel-body">
                    <h1 class="text-center">
                        {{{ .topic.Title }}}
                    </h1>

                    <div class="article-meta text-center">
                        {{{ date .topic.CreatedAt "Y-m-d H:i:s"}}}
                        ⋅
                        <span class="glyphicon glyphicon-comment" aria-hidden="true"></span>
                        {{{ .topic.ReplyCount }}}
                    </div>

                    <div class="topic-body">
                        {{{ str2html .topic.Body}}}
                    </div>

                    {{{if .CheckMe }}}                   
                        <div class="operate">
                            <hr>
                            <a href="/topics/edit/{{{ .topic.Id }}}" class="btn btn-default btn-xs pull-left" role="button">
                                <i class="glyphicon glyphicon-edit"></i> 编辑
                            </a>

                            <form action="/topics/destroy" method="post" class="formAjax">
                                {{{ .xsrf_html }}}
                                <input type="hidden" name="id" value="{{{ .topic.Id }}}">
                                <input type="hidden" name="user_id" value="{{{ .topic.UserId }}}">
                                <button type="submit" class="btn btn-default btn-xs pull-left" style="margin-left: 6px">
                                    <i class="glyphicon glyphicon-trash"></i>删除
                                </button>
                            </form>
                        </div>
                    {{{end}}}

                </div>
            </div>

           
            <div class="panel panel-default topic-reply">
                <div class="panel-body">
                    {{{ template "web/topic/_reply_box.html" .}}}
                    {{{ template "web/topic/_reply_list.html" .}}}
                </div>
            </div>
        </div>
    </div>
</div>
{{{ end }}}
{{{ template "web/layouts/footer.html" .}}}